package com.coolwen.springbootdemo.dao;

import com.coolwen.springbootdemo.model.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * @author CoolWen
 * @version 2020-06-11 8:54
 */
public interface UserRepository extends JpaRepository<User, Integer> {


    @Query("from User where id=?1")
    public User loadByUserId(Integer id);

    public List<User> findByNickname(String nickname);

    public Page<User> findByImg(String img, Pageable pageable);
}
